<template>
	<!-- 基础BOM下拉菜单信息 -->
	<v-combobox v-model="currentSelectBom" return-object :items="bomItems" label="选择基础BOM信息" dense outlined chips
		@input="bomSelectEvent">
	</v-combobox>
</template>

<script>
	export default {
		name: 'BomSelect',
		props: {
			callBack: {
				type: Function, //参数类型：函数
			},
			bomSelectModel: {
				loadBOMUrl: ``,
			},
		},
		data: () => ({
			bomItems: [],
			currentSelectBom: null
		}),
		created() {
			this.loadSelectBoms()
		},
		methods: {
			async loadSelectBoms() {
				var response = await this.$httpRequest({
					url: this.bomSelectModel.loadBOMUrl,
					method: 'get',
				})

				if (response.status == 1) {
					this.bomItems = response.data
				} else {
					this.$message.error('加载基础BOM信息失败！')
				}
			},
			bomSelectEvent(item) {
				this.$props.callBack(item)
			},

		}
	}
</script>

<style>
</style>
